/**  
* @Title: CustomerCardController.java  
* @Description: TODO(用一句话描述该文件做什么)  
* @author 张鑫
* @phone 17561783855  
* @date 2019年5月20日  
*/
package com.fortune.rainshinesystem.controller;

import com.fortune.rainshinecommon.model.system.CustomerServiceTotalModel;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.fortune.rainshinecommon.base.MsgModel;
import com.fortune.rainshinecommon.base.ParmsModel;
import com.fortune.rainshinecommon.model.system.CustomerCardModel;
import com.fortune.rainshinesystem.service.CustomerCardService;

import java.util.List;

/**  
* @ClassName: CustomerCardController  
* @Description: TODO(顾客会员卡功能)  
* @author 张鑫
* @phone 17561783855
* @date 2019年5月20日  
*    
*/
@RestController
@RequestMapping("/customerCard")
public class CustomerCardController {
	@Autowired
    private CustomerCardService service;

    @RequiresPermissions("customerCard:add")
    @PostMapping("/add")
    public MsgModel addCard(@RequestBody CustomerCardModel model){
        return service.add(model);
    }
	
	@PostMapping("/update")
    public MsgModel update(@RequestBody CustomerCardModel model){
        return service.update(model);
    }

    @RequiresPermissions("customerCard:view")
    @PostMapping("/list")
    public MsgModel cardList(@RequestBody ParmsModel parms){
        return service.list(parms);
    }

    @PostMapping("/delete")
    public MsgModel delShop(@RequestBody CustomerCardModel model){
        return service.delete(model);
    }

    @PostMapping("/getListByCustomerId")
    public List<CustomerServiceTotalModel> getListByCustomerId(@RequestBody Integer customerId){
        return service.getListByCustomerId(customerId);
    }
}
